import { LocalizationContext, MenuItem } from "../../core";

import { RenderOpenProps } from "./Open";
import OpenFileIcon from "./OpenFileIcon";
import { FC, useContext } from "react";

const OpenMenuItem: FC<RenderOpenProps> = ({ onClick }) => {
  const l10n = useContext(LocalizationContext);
  const label = l10n && l10n.open ? l10n.open.openFile : "Open file";

  return (
    <MenuItem
      icon={<OpenFileIcon />}
      onClick={() => {
        /**/
      }}
    >
      <div className="rpv-open__input-wrapper">
        <input
          className="rpv-open__input"
          multiple={false}
          type="file"
          title=""
          onChange={onClick}
        />
        {label}
      </div>
    </MenuItem>
  );
};

export default OpenMenuItem;
